<template>
  <div>
    <table class="table table-bordered">
      <tbody>
        <tr>
          <td><span style="color: red">*</span>姓名</td>
          <td>
            <input type="text" v-model="form.fangxing" />
          </td>
        </tr>
        <tr>
          <td><span style="color: red">*</span>密码</td>
          <td>
            <input type="password" v-model="form.fanghao" />
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
            <button class="btn btn-primary" @click="login">登录</button>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import axios from "axios";
import { onMounted, reactive, ref } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();
const form = reactive({
  id: 0,
  fangxing: "",
  weipai: "",
  yipai: "",
  fanghao: "",
});

const login = () => {
  if (!form.fangxing) {
    alert("姓名不能为空");
    return;
  }
  if (!form.fanghao) {
    alert("密码不能为空");
    return;
  }
alert("登录成功")
router.push("showpai")
    // .post("https://localhost:7074/api/paifang/Login?name="+form.fangxing+"pwd="+form.fanghao,form)
    // .then((res) => {
    //   if (res.data > 0) {
    //     alert("登录失败");
    //   } else {
    //     alert("登录成功");
        
    //   }
    // });
};
</script>

<style scoped></style>
